package role

import (
	"sanguo/node/node_game/module/role/team"
	cs_msg "sanguo/protocol/cs/message"

	"github.com/golang/protobuf/proto"
)

func (this *RoleModule) UpdateTeamToC(p proto.Message) {
	msg := p.(*cs_msg.UpdateTeamToC)

	_role := this.CurrentRole()
	if _role != nil && _role.IsRoleModleData() {
		if _role.Team == nil {
			_role.Team = &team.Team{
				TeamID: msg.GetUpdateTeam().GetTeamID(),
			}
			if _role.GetID() == msg.GetUpdateTeam().GetHeader() {
				_role.Team.TeamHeader = true
			} else {
				_role.Team.TeamHeader = false
			}
		}
	}
}
